import { create, update, remove, query } from '../../../../../framework/service/index';

const proIcon = require('../../../../../icons/personal/default-avatar.jpg')
export default {

  namespace: 'myEducationList',

  state: {
    date: [],

  },

  subscriptions: {
    setup({ dispatch, history }) {
      history.listen(location => {
        if(location.pathname === '/my-education-list') {
          // dispatch({
          //   type: 'query',
          // })
        }
      })
    },
  },



  effects: {
    *query({ payload }, { call, put }) {
      // const { code, data, message } = yield call(query, '/api/members/list', {});
      // yield put({
      //   type: 'querySuccess',
      //   payload: {
      //     list: personData
      //   }
      // })
      const proIcon = proIcon
    },
    *onUpload({ payload }, { call, put, select}) {

      // const imgURL = yield select(({myFeedback}) => myFeedback.imgURL)
      // const result = yield put({ type: 'querySuccess',payload:{imgURL:imgURL}});
      // var isPush = true
      // if (imgURL.length == 0) {
      //   const data = []
      //   data.push(payload.imgURL)
      //   yield put({
      //     type:'querySuccess',
      //     payload: {
      //       imgURL: data
      //     }
      //   })
      // } else if( imgURL.length < 3) {
      //   imgURL.push(payload.imgURL)
      //   yield put({
      //     type:'querySuccess',
      //     payload: {
      //       imgURL: imgURL
      //     }
      //   })
      // }
    },
    *onRemovePics({ payload }, {call, put, select}) {
      // const imgURL = yield select(({myFeedback}) => myFeedback.imgURL)
      // const data = []
      // for (var i = 0; i < imgURL.length; i++) {
      //   if (imgURL[i] != payload) {
      //     console.log(imgURL[i]);
      //     data.push(imgURL[i])
      //   }
      // }
      // yield put({
      //   type: 'querySuccess',
      //   payload: {
      //     imgURL: data
      //   }
      // })
    },

  },

  reducers: {
    querySuccess(state, action) {
      return { ...state, ...action.payload };
    },
  }

};
